home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 21
/
CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso
/
CDSupport
/
Visage
/
Rexx
/
ShowVisage.dopus5
< prev
next >
Wrap
Text File
|
1997-08-02
|
4KB
|
166 lines
/* $VER: ShowVisage.dopus5 1.0 (19.7.97)
*
* Public domain by Magnus Holmgren.
*
* Shows the files selected in the source listers, by creating a temporary
* file list, and passing this to Visage via the LIST argument. This
* requires Visage 39.15 or better to work.
*
* Usage: ShowVisage.dopus5 PortName VisageOpts
*
* PortName : Name of Opus ARexx port.
* VisageOpts : Any options to pass to Visage.
*
* Select "Run Asyncronously" if you like...
*/
/* Config section start */
/* Complete path to the Visage executable. */
VisagePath = 'Tools:View/Visage'
/* Path to drawer for the temporary file. Must end with ':' or '/' */
TempPath = 'T:'
/* Config section end */
/* Set up */
Lf = '0a'x
OPTIONS RESULTS
PARSE ARG Port ' ' VisageOpts
/* Make sure arguments are reasonable */
IF Port = '' | ~Show( 'P', Port ) THEN DO
/* Might not be visible when started incorrectly from Opus. ;) */
SAY 'ShowVisage.dopus5:'
SAY 'Not correctly called from Directory Opus 5!'
SAY 'See the ARexx-script for more information.'
RETURN
END
/* Talk to Directory Opus */
ADDRESS VALUE Port
/* Set break handling, since the script can take a while to finish */
SIGNAL ON BREAK_C
/* Open temporary file, using a unique name */
TempName = TempPath'ShowVisage.'Pragma( 'ID' )'.list'
IF ~Open( 'List', TempName, 'Write' ) THEN DO
CALL OpusMessage 'Couldn''t create temporary list file!'
RETURN
END
/* Get all source listers */
Lister Query Source
IF RC ~= 0 THEN DO
SIGNAL Failed
END
Listers = RESULT
/* And process the source listers one by one */
DO WHILE Listers ~= ''
PARSE VAR Listers Handle ' ' Listers
IF ~SaveListerEntries( Handle ) THEN DO
SIGNAL Terminate
END
END
/* Close generated file */
IF ~Close( 'List' ) THEN DO
CALL OpusMessage 'Couldn''t write to temporary list file!'
SIGNAL Terminate
END
/* We are now ready to display the files */
ADDRESS COMMAND VisagePath' LIST "'TempName'" 'VisageOpts
Command Delete '"'TempName'"' QUIET
RETURN
Failed:
CALL OpusMessage 'Failed to get needed information!'
/* Make a clean exit after break or error */
BREAK_C:
Terminate:
CALL Close( 'List' )
Command Delete '"'TempName'"' QUIET
RETURN
/* Save all selected entries in the specified lister to a file, and deselect
* the entries as we go
*/
SaveListerEntries:
PROCEDURE
Handle = Arg( 1 )
/* Get lister path. */
Lister Query Handle Path
FilePath = RESULT
IF RC ~= 0 THEN DO
CALL OpusMessage 'Couldn''t get lister path!'
RETURN 0
END
/* Make sure path is properly terminated */
IF Right( FilePath, 1 ) ~= ':' & Right( FilePath, 1 ) ~= '/' THEN DO
FilePath = FilePath'/'
END
/* Get the selected entries */
Lister Query Handle SelEntries
IF RC ~= 0 THEN DO
CALL OpusMessage 'Couldn''t get selected entries!'
RETURN 0
END
Files = RESULT
/* Here would probably be a good place to make the lister busy. However,
* it would make the script a bit more complicated, in order to ensure
* we don't leave a disabled lister behind us. And the busy stuff would
* only be useful with a fairly large number of files anyway...
*/
/* Iterate over all selected entries */
DO WHILE Files ~= ''
/* Extract one entry name */
PARSE VAR Files . '"' Name '"' Files
/* Write name to file */
IF WriteLN( 'List', FilePath||Name ) = 0 THEN DO
CALL OpusMessage 'Couldn''t write to temporary list file!'
RETURN 0
END
/* And deselect the file */
Lister Select Handle '"'Name'"' Off
END
/* Refresh lister display */
Lister Refresh Handle
RETURN 1
/* Show a message in an Opus requester, with a suitable "header" */
OpusMessage:
PROCEDURE
Lf = '0a'x
Message = 'ShowVisage.dopus5:'Lf||Lf||Arg(1)
DOpus Request '"'Message'"' 'OK'
RETURN